import React from 'react'
import { Table } from 'antd'

const UserList = ({
  onSelectUserRows,
  dataSource,
  selectedRowKeys
}) => {

  const columns = [
    {
      title: '用户名称',
      dataIndex: 'displayName',
      key: 'displayName',
      align: "left",
      width: 150
    }, {
      title: '手机号',
      dataIndex: 'mobile',
      key: 'mobile',
      align: "left",
      width: 150
    }, {
      title: '邮箱',
      dataIndex: 'email',
      key: 'email',
      align: "left",
      width: 150
    }
  ];

  const rowSelection = {
    type: 'check',
    onChange: onSelectUserRows,
    selectedRowKeys
  };

  return (
    <div>
      <Table
        pagination={false}
        dataSource={dataSource}
        columns={columns}
        rowKey={record => record.id}
        rowSelection={rowSelection}
        scroll={{ y: 410 }}
        size="small" />
    </div>
  )
};

export default UserList
